package com.aistar.order.mapper;

import com.aistar.order.entity.HotelOrder;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * Created by Administrator on 2019/6/25 0025.
 */
public interface HotelOrderMapper {
    //    找到具体订单
    @Select("select * from hotel_order where id =#{id}")
    HotelOrder findById(String id);
    //    找到一个用户所有的订单
    @Select("select * from hotel_order where user_id = #{userId}")
    List<HotelOrder> findMyOrder(String id);
    //    找到所有订单信息或根据id模糊查找
    @Select("select * from hotel_order where id like concat('%',#{id},'%')")
    List<HotelOrder> findAll(String id);
    //    保存订单的具体信息
    @Insert("insert into hotel_order values(#{id},#{orderId},#{createDate},#{orderPrice},#{orderState},#{hotelId},#{infoId},#{billId},#{userId},#{appraise},#{inDate},#{outDate},#{liveDay})")
    void save(HotelOrder hotelOrder);
    //    根据id删除具体订单
    @Delete("delete from hotel_order where id = #{id}")
    void delete(String id);
    //   修改订单信息
    @Update("update hotel_order set id=#{id},order_id=#{orderId},create_date=#{createDate},order_price=#{orderPrice},order_state=#{orderState},hotel_id=#{hotelId},info_id=#{infoId},bill_id=#{billId},user_id=#{userId},appraise=#{appraise},in_date=#{inDate},out_date=#{outDate},live_day=#{liveDay} where id=#{id}")
    void update(HotelOrder hotelOrder);
}
